// pages/mine_center/caips/caips.js
const app = getApp();
var request = require("../../../utils/request.js");
var page = 1;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show_have: true,
    caip_lists:""    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var data = {
      limit:10,
      page: page
    }
    request.request(app.globalData.getScheduleList,data,function(res){
      console.log(res)
      if(res.code == 0){
         that.setData({
           caip_lists: res.list,
           img_url: request.url + "/",
         })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    //快捷导航跳转
    this.turn = request.turn;
    this.close_modal = request.close_modal;
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  progress:function(e){
    console.log(e)
    var order_id = e.currentTarget.dataset.order_id;
    var shoottime = e.currentTarget.dataset.shoottime;
    var store_id = e.currentTarget.dataset.store_id;
    var schedule = e.currentTarget.dataset.schedule;
    wx.setStorageSync("storeId", store_id);
    
    if (schedule==1){
      wx.navigateTo({
        url: '/pages/mine_center/caips_appiontment/appiontment?order_id=' + order_id + '&shoottime=' + shoottime + '&store_id=' + store_id,
      })      
    } else if (schedule == 2){
      wx.navigateTo({
        url: "/pages/mine_center/caips_shop/shop?order_id=" + order_id
      })    
    } else if (schedule == 3){
      wx.navigateTo({
        url: "/pages/mine_center/sample/sample?order_id=" + order_id
      })         
    } else if (schedule == 4){
      wx.navigateTo({
        url: "/pages/mine_center/set_up/set_up?order_id=" + order_id
      })               
    }


  }
})